const path = require('path')

function resolve(dir){
  return path.join(__dirname, dir)
}

module.exports = {
  chainWebpack: config => {
    config.resolve.alias
      .set('@', resolve('src'));
    const types = ['vue-modules', 'vue', 'normal-modules', 'normal'];
    types.forEach(type => addStyleResource(config.module.rule('less').oneOf(type)));
    require('vux-loader').merge(config, {
      options: {},
      plugins: ['vux-ui']
    })
  },
  css: {
    sourceMap: true
  },
  devServer:{
    port:8095
  }
}

function addStyleResource(rule) {
	rule
		.use('style-resource')
		.loader('style-resources-loader')
		.options({
			patterns: [resolve('./src/assets/css/base/variable/variables.less'),resolve('./src/assets/css/base/mixin/1px.less')]
		});
}